package routers

import (
	"github.com/gin-gonic/gin"
	swaggerfiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
	"gvb-server/Middlewares"
	"net/http"
)

type ApiRoute struct{}

var ApiRouteGroup = new(ApiRoute)

func InitRoutes() *gin.Engine {
	route := gin.Default()
	route.GET("test", func(c *gin.Context) {
		c.JSON(http.StatusOK, "test")
	})

	route.Use(Middlewares.Cors())

	route.GET("swager/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))

	PublicGroup := route.Group("api")
	{
		ApiRouteGroup.SiteInfoRoute(PublicGroup) // 那边设置组
		ApiRouteGroup.ImageUpload(PublicGroup)
		ApiRouteGroup.Advert(PublicGroup)
		ApiRouteGroup.Menu(PublicGroup)
		ApiRouteGroup.User(PublicGroup)
		ApiRouteGroup.Msg(PublicGroup)
		ApiRouteGroup.UserAG(PublicGroup)
		ApiRouteGroup.Pub(PublicGroup)
		ApiRouteGroup.HFPay(PublicGroup)
	}
	return route
}
